package com.nyist.entity;

import java.util.Date;

import org.springframework.data.annotation.Id;
//以上为lombok动态实现完全封装的注解
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;
//Document注解，用来标识实体类对应的索引名（indexName ），类型（type），分区等
@Document(indexName = "test_user",type = "user")
public class User {
    @Id
    //标识主键
    private Long id;
    //为文本类型字段指定（插入，查询）分词器，指定字段类型
    @Field(analyzer = "ik_max_word",searchAnalyzer = "ik_max_word",type = FieldType.Text)
    private String name;
    
	@Field(type = FieldType.Integer)
	private Integer age;
	
	@Field(type = FieldType.Double)
	private double salary;
    
    @DateTimeFormat(style = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Field(type = FieldType.Date)
    //指定日期类型格式
    private Date birthday;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getAge() {
		return age;
	}

	public void setAge(Integer age) {
		this.age = age;
	}

	public double getSalary() {
		return salary;
	}

	public void setSalary(double salary) {
		this.salary = salary;
	}

	public Date getBirthday() {
		return birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
      
}
